<template>
  <div class="postdetail">
    <div class="item">
      <h3>{{ list.name }}</h3>
      <p>{{ list.content }}</p>
      <span>浏览次数：{{ list.views }}</span>
      <span>发布时间：{{ list.createdAt | time }}</span>
    </div>
  </div>
</template>

<script>
import { loadDetail } from "../services/posts";
export default {
  data() {
    return {
      list: {},
    };
  },
  created() {
    loadDetail(this.$route.query.id).then(
      (res) => (this.list = { ...res.data })
    );
  },
};
</script>

<style scoped>
.item {
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: flex-start;
  text-align: left;
}
p {
  line-height: 22px;
  padding: 20px 0;
}
span {
  color: #999;
  font-size: 12px;
}
</style>